package algebra;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

import index.DescriptionIndex;
import kb.TBox;
import utils.Util;
import utils.exception.OrderingDescriptionException;
import utils.io.KBAccess;

public class TestIndexBuilding {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws OrderingDescriptionException 
	 */
	public static void main(String[] args) throws IOException, OrderingDescriptionException {

		//OrderingDescription.ENABLE_OPTIMIZATIONS = false;
		//ProjectionQueryVisitorEvaluator.ENABLE_OPTIMIZATIONS = false;
		
		TBox tb = KBAccess.getTBox("pub_dblp.tbox", true);
		System.out.println("Loaded TBox");
		
		String[] ods = {"(feature year un)", "(feature year un)", "(feature title (feature year un))", "(partition (<= (role year) 2002) (feature title un) (feature year un))", "(partition (<= (role year) 2004) (partition (= (role year) 2001) (feature title un) (feature year un)) (feature title un))"};
		
		for (String odString : ods) {
			System.out.println("Building index: " + odString);
			OrderingDescription od = new OrderingDescription(odString, null);
			DescriptionIndex idx = new DescriptionIndex(od);
			long indexTime = System.currentTimeMillis();
			idx.load("pub_dblp.abox");
			indexTime = System.currentTimeMillis() - indexTime;
			System.out.println("Index TIME: " + indexTime + "ms");
		}
	}

}
